package mapgenerator;

import com.ip.IPPanelWidget;
import com.ip.IPControlPanel;
import com.im.IMPanelWidget;
import com.im.IMDialogBrowseFile;
import com.im.IMControlPanel;
import com.graphics.ImageContainer;
import com.graphics.ImageManager;
import com.ip.PatternContainer;
import com.lm.LMControlPanel;
import com.os.OSDialogCreateSprite;
import com.os.ObjectSpriteControlPanel;
import com.os.ObjectSpritePanelWidget;
import com.os.ObjectSpriteContainer;
import com.utils.MapOperation;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.DebugGraphics;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JSlider;
import javax.swing.JSpinner;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JToggleButton;
import javax.swing.KeyStroke;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
import org.netbeans.lib.awtextra.AbsoluteConstraints;
import org.netbeans.lib.awtextra.AbsoluteLayout;

/*
 * MAP GENERATOR 
 * VERSION 1.0
 */

/*
 * Main.java
 *
 * Created on Jan 17, 2009, 8:59:13 AM
 *
 * @author Sajarwo Anggai
 */
public class Main extends javax.swing.JFrame {

    /** Creates new form Main */
    public Main() {
        try {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
        } catch (Exception e) {
            System.out.print("System can't find Nimbus style");
        }
        //  JFrame.setDefaultLookAndFeelDecorated(true);
        initComponents();
        initManual();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        WorkspaceMainPanelBackup = new JPanel();
        OSPopupMenuBound = new JPopupMenu();
        AddNew = new JMenuItem();
        Edit = new JMenuItem();
        Remove = new JMenuItem();
        jSeparator1 = new JSeparator();
        MoveUp = new JMenuItem();
        MoveDown = new JMenuItem();
        TabbedPane = new JTabbedPane();
        ScrollPaneWorkspace = new JScrollPane();
        WorkspaceSplitPane = new JSplitPane();
        WorkspaceTop = new JSplitPane();
        WorkspaceTopLeft = new JPanel();
        WorkspaceToolbar = new JPanel();
        jButton1 = new JButton();
        jButton2 = new JButton();
        jButton3 = new JButton();
        jButton4 = new JButton();
        jButton5 = new JButton();
        ToolbarP = new JToggleButton();
        ToolbarS = new JToggleButton();
        ScrollPaneWorkspaceRender = new JScrollPane();
        WorkspaceRender = new JPanel();
        PanelLayerManager = new JPanel();
        ScrollPanePanelLayerManager = new JScrollPane();
        WorkspaceBottom = new JPanel();
        ScrollPaneImageManager = new JScrollPane();
        ImageManagerMainPanel = new JPanel();
        ButtonAddImageManagerLeftPanel = new JButton();
        LabelListofImageImageManagerLeftPanel = new JLabel();
        LabelPreviewImageManagerRightPanel = new JLabel();
        ImageManagerLeftPanelRender = new JPanel();
        ScrollPaneImageManagerRightPanel = new JScrollPane();
        ImageManagerRightPanelRender = new JPanel();
        IMButtonAddToPattern = new JButton();
        IMButtonAddToSprite = new JButton();
        IMButtonRemove = new JButton();
        IMButtonRename = new JButton();
        IMWidth = new JLabel();
        IMHeight = new JLabel();
        IMSize = new JLabel();
        IMWidthValue = new JLabel();
        IMHeightValue = new JLabel();
        IMSizeValue = new JLabel();
        BackgroundImageManager = new JLabel();
        ScrollPaneImagePattern = new JScrollPane();
        ImagePatternMainPanel = new JPanel();
        LabelOperationImagePatternLeftPanel = new JLabel();
        LabelListofPatternImagePatternLeftPanel = new JLabel();
        LabelPreviewImagePatternRightPanel = new JLabel();
        ImagePatternLeftPanelRender = new JPanel();
        ScrollPaneImagePatternRightPanel = new JScrollPane();
        ImagePatternRightPanelRender = new JPanel();
        IPHGap = new JLabel();
        IPVGap = new JLabel();
        IPHGapSlider = new JSlider();
        IPVGapSlider = new JSlider();
        IPButtonRename = new JButton();
        IPButtonSetOnWorkspace = new JButton();
        IPButtonRemove = new JButton();
        BackgroundImagePattern = new JLabel();
        ScrollPaneObjectSprite = new JScrollPane();
        ObjectSpriteMainPanel = new JPanel();
        ButtonAddObjectSpriteLeftPanel = new JButton();
        LabelListofObjectSpriteLeftPanel = new JLabel();
        LabelPreviewObjectSpriteRightPanel = new JLabel();
        ObjectSpriteLeftPanelRender = new JPanel();
        ScrollPaneObjectSpriteRightPanel = new JScrollPane();
        ObjectSpriteRightPanelRender = new JPanel();
        ScrollPaneObjectSpriteBound = new JScrollPane();
        ObjectSpriteListOfBound = new JList();
        jLabelListOfBounds = new JLabel();
        ObjectSpriteDelayAnimationTime = new JSpinner();
        Sec = new JLabel();
        jLabelDelayTime = new JLabel();
        ObjectSpriteButtonAddToPattern = new JButton();
        ObjectSpriteButtonRename = new JButton();
        ObjectSpriteButtonSetOnWorkspace = new JButton();
        ObjectSpriteButtonRemove = new JButton();
        OSLabelOperation = new JLabel();
        ObjectSpriteButtonPlay = new JButton();
        ObjectSpriteButtonStop = new JButton();
        ObjectSpriteButtonPause = new JButton();
        Play = new JLabel();
        MenuBar = new JMenuBar();
        MenuFile = new JMenu();
        FileNewProject = new JMenuItem();
        FileOpenProject = new JMenuItem();
        FileSaveProject = new JMenuItem();
        FileCloseProject = new JMenuItem();
        FileExit = new JMenuItem();
        MenuView = new JMenu();
        MenuTools = new JMenu();
        MenuHelp = new JMenu();

        WorkspaceMainPanelBackup.setMaximumSize(new Dimension(1009, 659));
        WorkspaceMainPanelBackup.setMinimumSize(new Dimension(1009, 659));
        WorkspaceMainPanelBackup.setPreferredSize(new Dimension(1009, 659));
        WorkspaceMainPanelBackup.setLayout(new AbsoluteLayout());

        AddNew.setText("Add New ");
        OSPopupMenuBound.add(AddNew);

        Edit.setText("Edit");
        OSPopupMenuBound.add(Edit);

        Remove.setText("Remove");
        OSPopupMenuBound.add(Remove);
        OSPopupMenuBound.add(jSeparator1);

        MoveUp.setText("Move Up");
        OSPopupMenuBound.add(MoveUp);

        MoveDown.setText("Move Down");
        OSPopupMenuBound.add(MoveDown);

        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setTitle("Map Generator Pada Game Strategi");
        setLocationByPlatform(true);
        setMaximizedBounds(new Rectangle(0, 0, 1024, 768));
        setMinimumSize(new Dimension(500, 500));
        addWindowListener(new WindowAdapter() {
            public void windowOpened(WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        TabbedPane.setTabPlacement(JTabbedPane.BOTTOM);

        ScrollPaneWorkspace.setBorder(null);

        WorkspaceSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
        WorkspaceSplitPane.setMaximumSize(new Dimension(1009, 659));
        WorkspaceSplitPane.setMinimumSize(new Dimension(1009, 659));
        WorkspaceSplitPane.setPreferredSize(new Dimension(1009, 659));

        WorkspaceTopLeft.setMinimumSize(new Dimension(500, 200));
        WorkspaceTopLeft.setPreferredSize(new Dimension(800, 570));
        WorkspaceTopLeft.setLayout(new BorderLayout());

        WorkspaceToolbar.setBackground(new Color(51, 102, 255));
        WorkspaceToolbar.setLayout(new BoxLayout(WorkspaceToolbar, BoxLayout.Y_AXIS));

        jButton1.setText("1");
        jButton1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        WorkspaceToolbar.add(jButton1);

        jButton2.setText("2");
        jButton2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        WorkspaceToolbar.add(jButton2);

        jButton3.setText("3");
        WorkspaceToolbar.add(jButton3);

        jButton4.setText("4");
        WorkspaceToolbar.add(jButton4);

        jButton5.setText("5");
        WorkspaceToolbar.add(jButton5);

        ToolbarP.setText("P");
        WorkspaceToolbar.add(ToolbarP);

        ToolbarS.setText("S");
        WorkspaceToolbar.add(ToolbarS);

        WorkspaceTopLeft.add(WorkspaceToolbar, BorderLayout.LINE_START);

        ScrollPaneWorkspaceRender.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        ScrollPaneWorkspaceRender.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        ScrollPaneWorkspaceRender.setMinimumSize(new Dimension(742, 551));
        ScrollPaneWorkspaceRender.setPreferredSize(new Dimension(742, 551));

        WorkspaceRender.setBackground(new Color(255, 51, 51));
        WorkspaceRender.setMinimumSize(new Dimension(0, 0));
        WorkspaceRender.setPreferredSize(new Dimension(0, 0));

        GroupLayout WorkspaceRenderLayout = new GroupLayout(WorkspaceRender);
        WorkspaceRender.setLayout(WorkspaceRenderLayout);
        WorkspaceRenderLayout.setHorizontalGroup(
            WorkspaceRenderLayout.createParallelGroup(Alignment.LEADING)
            .addGap(0, 742, Short.MAX_VALUE)
        );
        WorkspaceRenderLayout.setVerticalGroup(
            WorkspaceRenderLayout.createParallelGroup(Alignment.LEADING)
            .addGap(0, 551, Short.MAX_VALUE)
        );

        ScrollPaneWorkspaceRender.setViewportView(WorkspaceRender);

        WorkspaceTopLeft.add(ScrollPaneWorkspaceRender, BorderLayout.CENTER);

        WorkspaceTop.setLeftComponent(WorkspaceTopLeft);

        PanelLayerManager.setPreferredSize(new Dimension(0, 0));
        PanelLayerManager.setLayout(new BorderLayout());

        ScrollPanePanelLayerManager.setMinimumSize(new Dimension(0, 0));
        ScrollPanePanelLayerManager.setPreferredSize(null);
        PanelLayerManager.add(ScrollPanePanelLayerManager, BorderLayout.CENTER);

        WorkspaceTop.setRightComponent(PanelLayerManager);

        WorkspaceSplitPane.setTopComponent(WorkspaceTop);

        WorkspaceBottom.setBackground(new Color(204, 255, 204));
        WorkspaceBottom.setPreferredSize(new Dimension(0, 0));

        GroupLayout WorkspaceBottomLayout = new GroupLayout(WorkspaceBottom);
        WorkspaceBottom.setLayout(WorkspaceBottomLayout);
        WorkspaceBottomLayout.setHorizontalGroup(
            WorkspaceBottomLayout.createParallelGroup(Alignment.LEADING)
            .addGap(0, 1018, Short.MAX_VALUE)
        );
        WorkspaceBottomLayout.setVerticalGroup(
            WorkspaceBottomLayout.createParallelGroup(Alignment.LEADING)
            .addGap(0, 81, Short.MAX_VALUE)
        );

        WorkspaceSplitPane.setRightComponent(WorkspaceBottom);

        ScrollPaneWorkspace.setViewportView(WorkspaceSplitPane);

        TabbedPane.addTab("Workspace", ScrollPaneWorkspace);

        ScrollPaneImageManager.setBorder(null);
        ScrollPaneImageManager.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        ScrollPaneImageManager.setOpaque(false);

        ImageManagerMainPanel.setMaximumSize(new Dimension(1009, 659));
        ImageManagerMainPanel.setMinimumSize(new Dimension(1009, 659));
        ImageManagerMainPanel.setOpaque(false);
        ImageManagerMainPanel.setPreferredSize(new Dimension(1009, 659));
        ImageManagerMainPanel.setLayout(new AbsoluteLayout());

        ButtonAddImageManagerLeftPanel.setText("Add Image");
        ButtonAddImageManagerLeftPanel.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                ImageManagerLeftPanelActionPerformed(evt);
            }
        });
        ImageManagerMainPanel.add(ButtonAddImageManagerLeftPanel, new AbsoluteConstraints(100, 580, 100, 30));

        LabelListofImageImageManagerLeftPanel.setText("List of Image");
        LabelListofImageImageManagerLeftPanel.setAlignmentY(0.0F);
        LabelListofImageImageManagerLeftPanel.setFocusable(false);
        LabelListofImageImageManagerLeftPanel.setHorizontalTextPosition(SwingConstants.LEFT);
        ImageManagerMainPanel.add(LabelListofImageImageManagerLeftPanel, new AbsoluteConstraints(50, 20, 80, -1));

        LabelPreviewImageManagerRightPanel.setText("Preview");
        LabelPreviewImageManagerRightPanel.setAlignmentY(0.0F);
        ImageManagerMainPanel.add(LabelPreviewImageManagerRightPanel, new AbsoluteConstraints(570, 20, 60, -1));

        ImageManagerLeftPanelRender.setBackground(new Color(226, 235, 227));
        ImageManagerLeftPanelRender.setBorder(BorderFactory.createEtchedBorder());
        ImageManagerLeftPanelRender.setDebugGraphicsOptions(DebugGraphics.NONE_OPTION);
        ImageManagerLeftPanelRender.setDoubleBuffered(false);
        ImageManagerLeftPanelRender.setMinimumSize(new Dimension(200, 320));
        ImageManagerLeftPanelRender.setPreferredSize(new Dimension(200, 320));
        ImageManagerLeftPanelRender.setLayout(new GridLayout(1, 0));
        ImageManagerMainPanel.add(ImageManagerLeftPanelRender, new AbsoluteConstraints(0, 51, -1, 520));

        ScrollPaneImageManagerRightPanel.setBackground(new Color(219, 222, 255));
        ScrollPaneImageManagerRightPanel.setOpaque(false);
        ScrollPaneImageManagerRightPanel.setPreferredSize(new Dimension(807, 560));

        ImageManagerRightPanelRender.setBackground(new Color(226, 235, 227));
        ImageManagerRightPanelRender.setBorder(BorderFactory.createEtchedBorder());
        ImageManagerRightPanelRender.setLayout(null);
        ScrollPaneImageManagerRightPanel.setViewportView(ImageManagerRightPanelRender);

        ImageManagerMainPanel.add(ScrollPaneImageManagerRightPanel, new AbsoluteConstraints(200, 95, -1, -1));

        IMButtonAddToPattern.setIcon(new ImageIcon(getClass().getResource("/com/images/property/addpattern_off.png"))); // NOI18N
        IMButtonAddToPattern.setBorder(null);
        IMButtonAddToPattern.setBorderPainted(false);
        IMButtonAddToPattern.setContentAreaFilled(false);
        IMButtonAddToPattern.setRolloverIcon(new ImageIcon(getClass().getResource("/com/images/property/addpattern_on.png"))); // NOI18N
        IMButtonAddToPattern.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        ImageManagerMainPanel.add(IMButtonAddToPattern, new AbsoluteConstraints(785, 45, -1, 20));

        IMButtonAddToSprite.setIcon(new ImageIcon(getClass().getResource("/com/images/property/addsprite_off.png"))); // NOI18N
        IMButtonAddToSprite.setBorder(null);
        IMButtonAddToSprite.setBorderPainted(false);
        IMButtonAddToSprite.setContentAreaFilled(false);
        IMButtonAddToSprite.setRolloverIcon(new ImageIcon(getClass().getResource("/com/images/property/addsprite_on.png"))); // NOI18N
        IMButtonAddToSprite.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        ImageManagerMainPanel.add(IMButtonAddToSprite, new AbsoluteConstraints(785, 70, -1, 20));

        IMButtonRemove.setIcon(new ImageIcon(getClass().getResource("/com/images/property/remove_off.png"))); // NOI18N
        IMButtonRemove.setBorder(null);
        IMButtonRemove.setBorderPainted(false);
        IMButtonRemove.setContentAreaFilled(false);
        IMButtonRemove.setPreferredSize(new Dimension(90, 20));
        IMButtonRemove.setRolloverIcon(new ImageIcon(getClass().getResource("/com/images/property/remove_on.png"))); // NOI18N
        IMButtonRemove.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        ImageManagerMainPanel.add(IMButtonRemove, new AbsoluteConstraints(910, 70, -1, -1));

        IMButtonRename.setIcon(new ImageIcon(getClass().getResource("/com/images/property/rename_off.png"))); // NOI18N
        IMButtonRename.setBorder(null);
        IMButtonRename.setBorderPainted(false);
        IMButtonRename.setContentAreaFilled(false);
        IMButtonRename.setPreferredSize(new Dimension(90, 20));
        IMButtonRename.setRolloverIcon(new ImageIcon(getClass().getResource("/com/images/property/rename_on.png"))); // NOI18N
        IMButtonRename.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        ImageManagerMainPanel.add(IMButtonRename, new AbsoluteConstraints(910, 45, -1, -1));

        IMWidth.setText("Width");
        ImageManagerMainPanel.add(IMWidth, new AbsoluteConstraints(210, 58, -1, -1));

        IMHeight.setText("Height");
        ImageManagerMainPanel.add(IMHeight, new AbsoluteConstraints(210, 77, -1, -1));

        IMSize.setText("File Size");
        ImageManagerMainPanel.add(IMSize, new AbsoluteConstraints(380, 58, -1, -1));
        ImageManagerMainPanel.add(IMWidthValue, new AbsoluteConstraints(260, 58, 110, 14));
        ImageManagerMainPanel.add(IMHeightValue, new AbsoluteConstraints(260, 77, 110, 14));
        ImageManagerMainPanel.add(IMSizeValue, new AbsoluteConstraints(430, 58, 110, 14));

        BackgroundImageManager.setIcon(new ImageIcon(getClass().getResource("/com/images/ImageManagerBackground.png"))); // NOI18N
        ImageManagerMainPanel.add(BackgroundImageManager, new AbsoluteConstraints(0, 0, -1, -1));

        ScrollPaneImageManager.setViewportView(ImageManagerMainPanel);

        TabbedPane.addTab("Image Manager", ScrollPaneImageManager);

        ScrollPaneImagePattern.setBorder(null);
        ScrollPaneImagePattern.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        ScrollPaneImagePattern.setOpaque(false);

        ImagePatternMainPanel.setMaximumSize(new Dimension(1009, 659));
        ImagePatternMainPanel.setMinimumSize(new Dimension(1009, 659));
        ImagePatternMainPanel.setOpaque(false);
        ImagePatternMainPanel.setPreferredSize(new Dimension(1009, 659));
        ImagePatternMainPanel.setLayout(new AbsoluteLayout());

        LabelOperationImagePatternLeftPanel.setText("Adjust:");
        ImagePatternMainPanel.add(LabelOperationImagePatternLeftPanel, new AbsoluteConstraints(10, 540, 80, -1));

        LabelListofPatternImagePatternLeftPanel.setText("List of Image Pattern");
        LabelListofPatternImagePatternLeftPanel.setAlignmentY(0.0F);
        LabelListofPatternImagePatternLeftPanel.setFocusable(false);
        LabelListofPatternImagePatternLeftPanel.setHorizontalTextPosition(SwingConstants.LEFT);
        ImagePatternMainPanel.add(LabelListofPatternImagePatternLeftPanel, new AbsoluteConstraints(30, 20, 130, -1));

        LabelPreviewImagePatternRightPanel.setText("Preview");
        LabelPreviewImagePatternRightPanel.setAlignmentY(0.0F);
        ImagePatternMainPanel.add(LabelPreviewImagePatternRightPanel, new AbsoluteConstraints(570, 20, 60, -1));

        ImagePatternLeftPanelRender.setBackground(new Color(226, 235, 227));
        ImagePatternLeftPanelRender.setBorder(BorderFactory.createEtchedBorder());
        ImagePatternLeftPanelRender.setDebugGraphicsOptions(DebugGraphics.NONE_OPTION);
        ImagePatternLeftPanelRender.setDoubleBuffered(false);
        ImagePatternLeftPanelRender.setMinimumSize(new Dimension(200, 320));
        ImagePatternLeftPanelRender.setPreferredSize(new Dimension(200, 320));
        ImagePatternLeftPanelRender.setLayout(new GridLayout(1, 0));
        ImagePatternMainPanel.add(ImagePatternLeftPanelRender, new AbsoluteConstraints(0, 51, -1, 480));

        ScrollPaneImagePatternRightPanel.setBackground(new Color(219, 222, 255));
        ScrollPaneImagePatternRightPanel.setOpaque(false);
        ScrollPaneImagePatternRightPanel.setPreferredSize(new Dimension(807, 560));

        ImagePatternRightPanelRender.setBackground(new Color(226, 235, 227));
        ImagePatternRightPanelRender.setBorder(BorderFactory.createEtchedBorder());
        ImagePatternRightPanelRender.setLayout(null);
        ScrollPaneImagePatternRightPanel.setViewportView(ImagePatternRightPanelRender);

        ImagePatternMainPanel.add(ScrollPaneImagePatternRightPanel, new AbsoluteConstraints(200, 95, -1, -1));

        IPHGap.setText("HGap: 5px");
        ImagePatternMainPanel.add(IPHGap, new AbsoluteConstraints(10, 560, 70, -1));

        IPVGap.setText("VGap: 5px");
        ImagePatternMainPanel.add(IPVGap, new AbsoluteConstraints(10, 590, 70, -1));

        IPHGapSlider.setMaximum(20);
        IPHGapSlider.setValue(5);
        ImagePatternMainPanel.add(IPHGapSlider, new AbsoluteConstraints(80, 560, 110, -1));

        IPVGapSlider.setMaximum(20);
        IPVGapSlider.setValue(5);
        ImagePatternMainPanel.add(IPVGapSlider, new AbsoluteConstraints(80, 590, 110, -1));

        IPButtonRename.setIcon(new ImageIcon(getClass().getResource("/com/images/property/rename_off.png"))); // NOI18N
        IPButtonRename.setBorder(null);
        IPButtonRename.setBorderPainted(false);
        IPButtonRename.setContentAreaFilled(false);
        IPButtonRename.setPreferredSize(new Dimension(90, 20));
        IPButtonRename.setRolloverIcon(new ImageIcon(getClass().getResource("/com/images/property/rename_on.png"))); // NOI18N
        IPButtonRename.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        ImagePatternMainPanel.add(IPButtonRename, new AbsoluteConstraints(910, 45, -1, -1));

        IPButtonSetOnWorkspace.setIcon(new ImageIcon(getClass().getResource("/com/images/property/remove_off.png"))); // NOI18N
        IPButtonSetOnWorkspace.setBorder(null);
        IPButtonSetOnWorkspace.setBorderPainted(false);
        IPButtonSetOnWorkspace.setContentAreaFilled(false);
        IPButtonSetOnWorkspace.setPreferredSize(new Dimension(90, 20));
        IPButtonSetOnWorkspace.setRolloverIcon(new ImageIcon(getClass().getResource("/com/images/property/remove_on.png"))); // NOI18N
        IPButtonSetOnWorkspace.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        ImagePatternMainPanel.add(IPButtonSetOnWorkspace, new AbsoluteConstraints(790, 70, -1, -1));

        IPButtonRemove.setIcon(new ImageIcon(getClass().getResource("/com/images/property/remove_off.png"))); // NOI18N
        IPButtonRemove.setBorder(null);
        IPButtonRemove.setBorderPainted(false);
        IPButtonRemove.setContentAreaFilled(false);
        IPButtonRemove.setPreferredSize(new Dimension(90, 20));
        IPButtonRemove.setRolloverIcon(new ImageIcon(getClass().getResource("/com/images/property/remove_on.png"))); // NOI18N
        IPButtonRemove.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        ImagePatternMainPanel.add(IPButtonRemove, new AbsoluteConstraints(910, 70, -1, -1));

        BackgroundImagePattern.setIcon(new ImageIcon(getClass().getResource("/com/images/ImageManagerBackground.png"))); // NOI18N
        ImagePatternMainPanel.add(BackgroundImagePattern, new AbsoluteConstraints(0, 0, -1, -1));

        ScrollPaneImagePattern.setViewportView(ImagePatternMainPanel);

        TabbedPane.addTab("Image Pattern", ScrollPaneImagePattern);

        ScrollPaneObjectSprite.setBorder(null);
        ScrollPaneObjectSprite.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        ScrollPaneObjectSprite.setOpaque(false);

        ObjectSpriteMainPanel.setMaximumSize(new Dimension(1009, 659));
        ObjectSpriteMainPanel.setMinimumSize(new Dimension(1009, 659));
        ObjectSpriteMainPanel.setOpaque(false);
        ObjectSpriteMainPanel.setPreferredSize(new Dimension(1009, 659));
        ObjectSpriteMainPanel.setLayout(new AbsoluteLayout());

        ButtonAddObjectSpriteLeftPanel.setText("Create Sprite");
        ButtonAddObjectSpriteLeftPanel.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                ButtonAddObjectSpriteLeftPanelImageManagerLeftPanelActionPerformed(evt);
            }
        });
        ObjectSpriteMainPanel.add(ButtonAddObjectSpriteLeftPanel, new AbsoluteConstraints(100, 580, 100, 30));

        LabelListofObjectSpriteLeftPanel.setText("List of Object Sprite");
        LabelListofObjectSpriteLeftPanel.setAlignmentY(0.0F);
        LabelListofObjectSpriteLeftPanel.setFocusable(false);
        LabelListofObjectSpriteLeftPanel.setHorizontalTextPosition(SwingConstants.LEFT);
        ObjectSpriteMainPanel.add(LabelListofObjectSpriteLeftPanel, new AbsoluteConstraints(30, 20, 130, -1));

        LabelPreviewObjectSpriteRightPanel.setText("Preview");
        LabelPreviewObjectSpriteRightPanel.setAlignmentY(0.0F);
        ObjectSpriteMainPanel.add(LabelPreviewObjectSpriteRightPanel, new AbsoluteConstraints(570, 20, 60, -1));

        ObjectSpriteLeftPanelRender.setBackground(new Color(226, 235, 227));
        ObjectSpriteLeftPanelRender.setBorder(BorderFactory.createEtchedBorder());
        ObjectSpriteLeftPanelRender.setDebugGraphicsOptions(DebugGraphics.NONE_OPTION);
        ObjectSpriteLeftPanelRender.setDoubleBuffered(false);
        ObjectSpriteLeftPanelRender.setMinimumSize(new Dimension(200, 320));
        ObjectSpriteLeftPanelRender.setPreferredSize(new Dimension(200, 400));
        ObjectSpriteLeftPanelRender.setLayout(new GridLayout(1, 0));
        ObjectSpriteMainPanel.add(ObjectSpriteLeftPanelRender, new AbsoluteConstraints(0, 51, -1, 520));

        ScrollPaneObjectSpriteRightPanel.setBackground(new Color(219, 222, 255));
        ScrollPaneObjectSpriteRightPanel.setOpaque(false);
        ScrollPaneObjectSpriteRightPanel.setPreferredSize(new Dimension(807, 560));

        ObjectSpriteRightPanelRender.setBackground(new Color(226, 235, 227));
        ObjectSpriteRightPanelRender.setBorder(BorderFactory.createEtchedBorder());
        ObjectSpriteRightPanelRender.setLayout(null);

        ObjectSpriteListOfBound.setComponentPopupMenu(OSPopupMenuBound);
        ScrollPaneObjectSpriteBound.setViewportView(ObjectSpriteListOfBound);

        ObjectSpriteRightPanelRender.add(ScrollPaneObjectSpriteBound);
        ScrollPaneObjectSpriteBound.setBounds(10, 30, 170, 180);

        jLabelListOfBounds.setText("List of Bounds:");
        ObjectSpriteRightPanelRender.add(jLabelListOfBounds);
        jLabelListOfBounds.setBounds(10, 10, 90, 14);

        ObjectSpriteDelayAnimationTime.setFont(new Font("Tahoma", 0, 14));
        ObjectSpriteDelayAnimationTime.setToolTipText("Delay Animation");
        ObjectSpriteRightPanelRender.add(ObjectSpriteDelayAnimationTime);
        ObjectSpriteDelayAnimationTime.setBounds(70, 220, 80, 24);

        Sec.setText("Sec.");
        ObjectSpriteRightPanelRender.add(Sec);
        Sec.setBounds(151, 230, 30, 14);

        jLabelDelayTime.setText("Delay Time");
        ObjectSpriteRightPanelRender.add(jLabelDelayTime);
        jLabelDelayTime.setBounds(10, 224, 70, 20);

        ScrollPaneObjectSpriteRightPanel.setViewportView(ObjectSpriteRightPanelRender);

        ObjectSpriteMainPanel.add(ScrollPaneObjectSpriteRightPanel, new AbsoluteConstraints(200, 95, -1, -1));

        ObjectSpriteButtonAddToPattern.setIcon(new ImageIcon(getClass().getResource("/com/images/property/insert_patern_off.png"))); // NOI18N
        ObjectSpriteButtonAddToPattern.setBorder(null);
        ObjectSpriteButtonAddToPattern.setBorderPainted(false);
        ObjectSpriteButtonAddToPattern.setContentAreaFilled(false);
        ObjectSpriteButtonAddToPattern.setRolloverIcon(new ImageIcon(getClass().getResource("/com/images/property/insertpatern_on.png"))); // NOI18N
        ObjectSpriteButtonAddToPattern.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        ObjectSpriteMainPanel.add(ObjectSpriteButtonAddToPattern, new AbsoluteConstraints(785, 45, -1, 20));

        ObjectSpriteButtonRename.setIcon(new ImageIcon(getClass().getResource("/com/images/property/rename_off.png"))); // NOI18N
        ObjectSpriteButtonRename.setBorder(null);
        ObjectSpriteButtonRename.setBorderPainted(false);
        ObjectSpriteButtonRename.setContentAreaFilled(false);
        ObjectSpriteButtonRename.setPreferredSize(new Dimension(90, 20));
        ObjectSpriteButtonRename.setRolloverIcon(new ImageIcon(getClass().getResource("/com/images/property/rename_on.png"))); // NOI18N
        ObjectSpriteButtonRename.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        ObjectSpriteMainPanel.add(ObjectSpriteButtonRename, new AbsoluteConstraints(910, 45, -1, -1));

        ObjectSpriteButtonSetOnWorkspace.setIcon(new ImageIcon(getClass().getResource("/com/images/property/remove_off.png"))); // NOI18N
        ObjectSpriteButtonSetOnWorkspace.setBorder(null);
        ObjectSpriteButtonSetOnWorkspace.setBorderPainted(false);
        ObjectSpriteButtonSetOnWorkspace.setContentAreaFilled(false);
        ObjectSpriteButtonSetOnWorkspace.setPreferredSize(new Dimension(90, 20));
        ObjectSpriteButtonSetOnWorkspace.setRolloverIcon(new ImageIcon(getClass().getResource("/com/images/property/remove_on.png"))); // NOI18N
        ObjectSpriteButtonSetOnWorkspace.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        ObjectSpriteMainPanel.add(ObjectSpriteButtonSetOnWorkspace, new AbsoluteConstraints(770, 70, -1, -1));

        ObjectSpriteButtonRemove.setIcon(new ImageIcon(getClass().getResource("/com/images/property/remove_off.png"))); // NOI18N
        ObjectSpriteButtonRemove.setBorder(null);
        ObjectSpriteButtonRemove.setBorderPainted(false);
        ObjectSpriteButtonRemove.setContentAreaFilled(false);
        ObjectSpriteButtonRemove.setPreferredSize(new Dimension(90, 20));
        ObjectSpriteButtonRemove.setRolloverIcon(new ImageIcon(getClass().getResource("/com/images/property/remove_on.png"))); // NOI18N
        ObjectSpriteButtonRemove.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        ObjectSpriteMainPanel.add(ObjectSpriteButtonRemove, new AbsoluteConstraints(910, 70, -1, -1));

        OSLabelOperation.setText("Operation:");
        ObjectSpriteMainPanel.add(OSLabelOperation, new AbsoluteConstraints(210, 60, 60, 30));

        ObjectSpriteButtonPlay.setIcon(new ImageIcon(getClass().getResource("/com/images/property/play_off.png"))); // NOI18N
        ObjectSpriteButtonPlay.setContentAreaFilled(false);
        ObjectSpriteButtonPlay.setRolloverIcon(new ImageIcon(getClass().getResource("/com/images/property/play_on.png"))); // NOI18N
        ObjectSpriteButtonPlay.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        ObjectSpriteMainPanel.add(ObjectSpriteButtonPlay, new AbsoluteConstraints(350, 60, 32, 32));

        ObjectSpriteButtonStop.setIcon(new ImageIcon(getClass().getResource("/com/images/property/play_off.png"))); // NOI18N
        ObjectSpriteButtonStop.setContentAreaFilled(false);
        ObjectSpriteButtonStop.setRolloverIcon(new ImageIcon(getClass().getResource("/com/images/property/play_on.png"))); // NOI18N
        ObjectSpriteButtonPlay.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        ObjectSpriteMainPanel.add(ObjectSpriteButtonStop, new AbsoluteConstraints(270, 60, 32, 32));

        ObjectSpriteButtonPause.setIcon(new ImageIcon(getClass().getResource("/com/images/property/pause_off.png"))); // NOI18N
        ObjectSpriteButtonPause.setContentAreaFilled(false);
        ObjectSpriteButtonPause.setRolloverIcon(new ImageIcon(getClass().getResource("/com/images/property/pause_on.png"))); // NOI18N
        ObjectSpriteButtonPlay.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        ObjectSpriteMainPanel.add(ObjectSpriteButtonPause, new AbsoluteConstraints(310, 60, 32, 32));

        Play.setIcon(new ImageIcon(getClass().getResource("/com/images/ImageManagerBackground.png"))); // NOI18N
        ObjectSpriteMainPanel.add(Play, new AbsoluteConstraints(0, 0, -1, -1));

        ScrollPaneObjectSprite.setViewportView(ObjectSpriteMainPanel);

        TabbedPane.addTab("Object Sprite", ScrollPaneObjectSprite);

        MenuFile.setText("File");

        FileNewProject.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_MASK));
        FileNewProject.setText("NewProject");
        MenuFile.add(FileNewProject);

        FileOpenProject.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK));
        FileOpenProject.setText("Open Project");
        MenuFile.add(FileOpenProject);

        FileSaveProject.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK));
        FileSaveProject.setText("Save Project");
        MenuFile.add(FileSaveProject);

        FileCloseProject.setText("Close Project");
        MenuFile.add(FileCloseProject);

        FileExit.setText("Exit");
        MenuFile.add(FileExit);

        MenuBar.add(MenuFile);

        MenuView.setText("View");
        MenuBar.add(MenuView);

        MenuTools.setText("Tools");
        MenuBar.add(MenuTools);

        MenuHelp.setText("Help");
        MenuBar.add(MenuHelp);

        setJMenuBar(MenuBar);

        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(Alignment.LEADING)
            .addComponent(TabbedPane, GroupLayout.DEFAULT_SIZE, 1025, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(Alignment.LEADING)
            .addComponent(TabbedPane, GroupLayout.DEFAULT_SIZE, 688, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void formWindowOpened(WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
        setExtendedState(MAXIMIZED_BOTH);
    }//GEN-LAST:event_formWindowOpened

    private void ImageManagerLeftPanelActionPerformed(ActionEvent evt) {//GEN-FIRST:event_ImageManagerLeftPanelActionPerformed
        Object ob = evt.getSource();
        if (ob == ButtonAddImageManagerLeftPanel) {
            IMDialogBrowseFile browseFile = new IMDialogBrowseFile(project, imContainer, imPanelWidget);
            browseFile.setModal(true);
            browseFile.setVisible(true);
        }
    }//GEN-LAST:event_ImageManagerLeftPanelActionPerformed

    private void ButtonAddObjectSpriteLeftPanelImageManagerLeftPanelActionPerformed(ActionEvent evt) {//GEN-FIRST:event_ButtonAddObjectSpriteLeftPanelImageManagerLeftPanelActionPerformed
        // TODO add your handling code here:
        OSDialogCreateSprite dcs = new OSDialogCreateSprite(this);
        dcs.setModal(true);
        dcs.setVisible(true);
        osPanelWidget.reloadAll();
}//GEN-LAST:event_ButtonAddObjectSpriteLeftPanelImageManagerLeftPanelActionPerformed

    private void jButton1ActionPerformed(ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        WorkspaceRender.setPreferredSize(new Dimension(1000,1000));
        WorkspaceRender.revalidate();
        repaint();
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton2ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Main().setVisible(true);
            }
        });
    }

    /**
     * Inisialisasi Manual
     */
    public void initManual() {
        //project
        project = new Project(this);
        mapOperation = new MapOperation(this);
        // Panel Widget Image Manager
        imContainer = new ImageContainer(this);
        imControlPanel = new IMControlPanel(this);
        imPanelWidget = new IMPanelWidget(this);
        imPanelWidget.reloadAll();
        imWidget = new JScrollPane(imPanelWidget);
        imWidget.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        Dimension minimumSize = new Dimension(100, 50);
        imWidget.setMinimumSize(minimumSize);
        ImageManagerLeftPanelRender.add(imWidget);


        // Image Manager for Image Pattern
        ipControlPanel = new IPControlPanel(this);
        ipImageManager = new ImageManager();
        ipContainer = new PatternContainer(this);
        ipPanelWidget = new IPPanelWidget(this);
        ipPanelWidget.reloadAll();

        // Sprite
        osControlPanel = new ObjectSpriteControlPanel(this);
        osContainer = new ObjectSpriteContainer(this);
        osPanelWidget = new ObjectSpritePanelWidget(this);
        osPanelWidget.reloadAll();

        // Layer Manager
        lmControlPanel = new LMControlPanel(this);

        // Workspace
        workspace =new WorkSpace(this);
    }
    //Variables declaration - Manual
    public Project project;
    public MapOperation mapOperation;
    // image manager
    public ImageContainer imContainer;
    public IMPanelWidget imPanelWidget;
    private JScrollPane imWidget;
    public IMControlPanel imControlPanel;
    // pattern
    public ImageManager ipImageManager;
    public PatternContainer ipContainer;
    public IPPanelWidget ipPanelWidget;
    private JScrollPane ipWidget;
    public IPControlPanel ipControlPanel;
    //sprite
    public ObjectSpriteContainer osContainer;
    public ObjectSpritePanelWidget osPanelWidget;
    public ObjectSpriteControlPanel osControlPanel;
    // Layer Manager
    public LMControlPanel lmControlPanel;
    //Workspace
    public WorkSpace workspace;
    // Variables declaration - do not modify//GEN-BEGIN:variables
    public JMenuItem AddNew;
    private JLabel BackgroundImageManager;
    private JLabel BackgroundImagePattern;
    private JButton ButtonAddImageManagerLeftPanel;
    private JButton ButtonAddObjectSpriteLeftPanel;
    public JMenuItem Edit;
    public JMenuItem FileCloseProject;
    public JMenuItem FileExit;
    public JMenuItem FileNewProject;
    public JMenuItem FileOpenProject;
    public JMenuItem FileSaveProject;
    public JButton IMButtonAddToPattern;
    public JButton IMButtonAddToSprite;
    public JButton IMButtonRemove;
    public JButton IMButtonRename;
    public JLabel IMHeight;
    public JLabel IMHeightValue;
    public JLabel IMSize;
    public JLabel IMSizeValue;
    public JLabel IMWidth;
    public JLabel IMWidthValue;
    public JButton IPButtonRemove;
    public JButton IPButtonRename;
    public JButton IPButtonSetOnWorkspace;
    public JLabel IPHGap;
    public JSlider IPHGapSlider;
    public JLabel IPVGap;
    public JSlider IPVGapSlider;
    private JPanel ImageManagerLeftPanelRender;
    private JPanel ImageManagerMainPanel;
    public JPanel ImageManagerRightPanelRender;
    public JPanel ImagePatternLeftPanelRender;
    private JPanel ImagePatternMainPanel;
    public JPanel ImagePatternRightPanelRender;
    private JLabel LabelListofImageImageManagerLeftPanel;
    private JLabel LabelListofObjectSpriteLeftPanel;
    private JLabel LabelListofPatternImagePatternLeftPanel;
    private JLabel LabelOperationImagePatternLeftPanel;
    private JLabel LabelPreviewImageManagerRightPanel;
    private JLabel LabelPreviewImagePatternRightPanel;
    private JLabel LabelPreviewObjectSpriteRightPanel;
    private JMenuBar MenuBar;
    private JMenu MenuFile;
    private JMenu MenuHelp;
    private JMenu MenuTools;
    private JMenu MenuView;
    public JMenuItem MoveDown;
    public JMenuItem MoveUp;
    private JLabel OSLabelOperation;
    private JPopupMenu OSPopupMenuBound;
    public JButton ObjectSpriteButtonAddToPattern;
    public JButton ObjectSpriteButtonPause;
    public JButton ObjectSpriteButtonPlay;
    public JButton ObjectSpriteButtonRemove;
    public JButton ObjectSpriteButtonRename;
    public JButton ObjectSpriteButtonSetOnWorkspace;
    public JButton ObjectSpriteButtonStop;
    public JSpinner ObjectSpriteDelayAnimationTime;
    public JPanel ObjectSpriteLeftPanelRender;
    public JList ObjectSpriteListOfBound;
    private JPanel ObjectSpriteMainPanel;
    public JPanel ObjectSpriteRightPanelRender;
    public JPanel PanelLayerManager;
    private JLabel Play;
    public JMenuItem Remove;
    private JScrollPane ScrollPaneImageManager;
    private JScrollPane ScrollPaneImageManagerRightPanel;
    private JScrollPane ScrollPaneImagePattern;
    private JScrollPane ScrollPaneImagePatternRightPanel;
    private JScrollPane ScrollPaneObjectSprite;
    public JScrollPane ScrollPaneObjectSpriteBound;
    private JScrollPane ScrollPaneObjectSpriteRightPanel;
    public JScrollPane ScrollPanePanelLayerManager;
    private JScrollPane ScrollPaneWorkspace;
    public JScrollPane ScrollPaneWorkspaceRender;
    public JLabel Sec;
    private JTabbedPane TabbedPane;
    public JToggleButton ToolbarP;
    public JToggleButton ToolbarS;
    public JPanel WorkspaceBottom;
    private JPanel WorkspaceMainPanelBackup;
    public JPanel WorkspaceRender;
    private JSplitPane WorkspaceSplitPane;
    private JPanel WorkspaceToolbar;
    private JSplitPane WorkspaceTop;
    private JPanel WorkspaceTopLeft;
    private JButton jButton1;
    private JButton jButton2;
    private JButton jButton3;
    private JButton jButton4;
    private JButton jButton5;
    private JLabel jLabelDelayTime;
    private JLabel jLabelListOfBounds;
    private JSeparator jSeparator1;
    // End of variables declaration//GEN-END:variables
}
